<template>
    <div class="m-center">
        <h3>扫码支付</h3>
        <van-image
                width="300"
                height="300"
                :src="payImg"
        />
        <div>支付完成后，将跳转至订单详情</div>
        <div style="margin-top: 40px">
            <span style="margin-right: 30px">打开支付宝 [扫一扫]</span>
            <van-button type="primary" @click="toOrderDetail">支付完成</van-button>
        </div>
    </div>
</template>

<script>
    import {payOrder} from "../../utils/apis";

    export default {
        name: "Pay",
        data() {
            return {
                payImg: ''
            }
        },
        created() {
            this.getPayImg()
        },
        methods: {
            getPayImg() {
                payOrder({
                    orderNo: this.$route.query.orderNo
                }).then(res => {
                    this.payImg = res.data
                })
            },
            toOrderDetail() {
                this.$router.push({name: "OrderDetail", query: {orderNo: this.$route.query.orderNo}})
            }
        }
    }
</script>

<style scoped>
    .m-center {
        text-align: center;
        margin: 0 auto;
    }
</style>
